<script type="text/javascript" language="javascript">
    $(function() {

    var dates = $( "#fromDate, #toDate" ).datepicker({
			 dateFormat:'yy-mm-dd',
			changeMonth: false,
                        numberOfMonths: 1,
                        defaultDate: "+1w",
			onSelect: function( selectedDate ) {
				var option = this.id == "fromDate" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});


	$(".datepicker").datepicker({
		showOn: 'focus',
		showButtonPanel: false,
		dateFormat:'yy-mm-dd'
	  });
      });
    
    
</script>
<div class="keywordHitLogs index">
    <?php echo $form->create('KeywordHitLog',array("action"=>"reportcharts"));?>
    <div class="fields clearfix">
        <h2>Filter for logs</h2>
        <p>

            Website: <?php  echo $form->input('website_id',array("div"=>false,"label"=>false,"class"=>"sSelect")); ?>
            From: <?php echo $form->input("fromDate",array("id"=>"fromDate","class"=>"sText small","div"=>false,"label"=>false)); ?>&nbsp;&nbsp;To:<?php echo $form->input("toDate",array("id"=>"toDate","class"=>"sText small","div"=>false,"label"=>false)); ?>
            <input type="submit" class="butDef" value="Search"  />
            <span>Error, data not valid</span>
        </p>
    </div>
    <?php echo $form->end();?>
    <div class="fields clearfix">
        <h2>Hit Logs</h2>
        <?php
        echo $flashChart->begin();
        //$flashChart->setTitle('Hit Logs','{color:#880a88;font-size:35px;padding-bottom:20px;}');
        $points = array();
        $labels = array();
        foreach($keywordHitLogs as $logs) {
            $points[]=$logs['0']['total'];
            $labels[] = date("F, d",strtotime($logs['KeywordHitLog']['hit_date']));
        }
        $points =  array_values($points);
        $flashChart->setData($points,'{n}',false,'Logs','log');



        $flashChart->axis('x',array('labels' =>$labels,'tick_height' => 20),array('vertical' => false,'colour'=>'#3399AA'));
        $flashChart->axis('y',array('range' => array(0,2*max($points),5)));
        echo $flashChart->chart('line',array('colour'=>'#880a88'),'Logs','log');
        echo $flashChart->render(680,400,'log');
        ?>
    </div>

</div>